-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support fk column with code_ or _code #296
base: master
Are you sure you want to change the base?
Conversation
Thanks for posting in our issue tracker.
Thanks! This is an automated comment, triggered by adding the label |
AFAIK, it is also common to use In my case, actually we are need to build REST API for a legacy desktop application. It will be nice, if string
August 2017, since at that time we'd just start the REST API development.
All relation name which it's foreign key has |
OK. Got it. I can't say that using Instead of introducing hardcoded |
@samdark |
Please, write unit tests for this case. |
} elseif (substr_compare($key, 'id', 0, 2, true) === 0) { | ||
$key = ltrim(substr($key, 2, strlen($key)), '_'); | ||
foreach ($this->fkColumnIdentifiers as $str) { | ||
if (!empty($key) && strcasecmp($key, $str)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's meant by strcasecmp
here? Not equal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i think so.
Actually i just copy that line from if (!empty($key) && strcasecmp($key, 'id')) {
and change id
string into $str
variable accordingly.
Is there anything that i should revise?
@dmirogin, as a matter of fact, at this time, i don't have much experience for writing unit testing yet. |
Thank you for putting effort in the improvement of the Yii framework. In order for the framework and your solution to remain stable in the future, we have a unit test requirement in place. Therefore we can only accept your pull request if it is covered by unit tests. Could you add these please? Thanks! P.S. If you have any questions about the creation of unit tests? Don't hesitate to ask for support. More information about unit tests This is an automated comment, triggered by adding the label |
Add support for foreign key column like
code_supplier
orsupplier_code